<?php


if (!defined('EBY_IN')){
	exit('HACKING NO INFO');
}
class Link extends base{
	Private $intLinkId;
	Private $strLinkName;
	Private $strLinkUrl;
	Private $strSQL;
	
	public function __construct(){
		parent::__construct();
	}
	
	public function add($arrVar){
		
		$this->strLinkName=$arrVar[0];
		$this->strLinkUrl=$arrVar[1];
		if ($this->strLinkName!='' && $this->strLinkUrl!=''){
			$this->strSQL="INSERT INTO ".DB_PREFIX."link 
							(eby_linkname,eby_linkurl,eby_linkclickcount,eby_linklock)
							VALUES
							('".$this->strLinkName."','".$this->strLinkUrl."',0,0)";
			$this->db->getSqlstr($this->strSQL);
			return $this->db->insertSql();
		}
	}
	public function getInfo($intType,$intId=0){
		$arrRs='';
		if ($intType==0){ $this->strSQL="SELECT * FROM ".DB_PREFIX."link "; }
		elseif ($intType==1)
		{ }
		$this->db->getSqlstr($this->strSQL);
		$arrRs=$this->db->res_list();
		return $arrRs;
	}
	public function getCount(){
		$this->strSQL="SELECT eby_linkid FROM ".DB_PREFIX."link ";
		$this->db->getSqlstr($this->strSQL);
		return $this->db->counts();
	}
	
	public function edit($arrVar){
		$this->strLinkName=$arrVar[0];
		$this->strLinkUrl=$arrVar[1];
		$this->intLinkId=$arrVar[2];
		if ($this->strLinkName!='' && $this->strLinkUrl!=''){
			$this->strSQL="UPDATE ".DB_PREFIX."link 
								  SET 
								  eby_linkname='".$this->strLinkName."',
								  eby_linkurl='".$this->strLinkUrl."' 
								  WHERE eby_linkid=".$this->intLinkId."";
		}
		$this->db->getSqlstr($this->strSQL);
		return $this->db->updateSql();
	}
	public function del($intId){
		$this->strSQL="DELETE FROM ".DB_PREFIX."link WHERE eby_linkid=".$intId."";
		$this->db->getSqlstr($this->strSQL);
		return $this->db->del();
	}
	public function appSQL($strSQL){
		$this->db->getSqlstr($strSQL);
		return $this->db-updateSql();
	}
}

?>